﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Retete.Models;
using System.Globalization;

namespace Retete.ViewModels
{
    public class MeniulZileiViewModel
    {
        public Meniu MeniulZilei { get; set; }
        public DateTime SelectedDate { get; set; }
        public List<MeniuReteta> Retete { get; set; }
        public MeniuReteta RetetaNoua { get; set; }
        public int IDRetetaStearsa { get; set; }

        public string TitluVizualizare { get; set; }
        public string InsertionRowVisibility { get; set; }

        public MeniulZileiViewModel(Meniu setMeniulZilei, DateTime setSelectedDate)
        {
            MeniulZilei = setMeniulZilei;
            SelectedDate = setSelectedDate;
            Retete = setMeniulZilei.Retete.ToList();
            RetetaNoua = new MeniuReteta();
            IDRetetaStearsa = -1;

            if (setSelectedDate.Date < DateTime.Today) TitluVizualizare = "Consultare meniul zilei (" + setSelectedDate.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture) + ")";
            else if (setSelectedDate.Date == DateTime.Today) TitluVizualizare = "Consultare meniul zilei (astazi)";
            else if (setSelectedDate.AddDays(-1).Date == DateTime.Today) TitluVizualizare = "Configurare meniul zilei (maine)";
            else if (setSelectedDate.AddDays(-2).Date == DateTime.Today) TitluVizualizare = "Configurare meniul zilei (poimaine)";
            else TitluVizualizare = "Configurare meniul zilei (" + setSelectedDate.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture) + ")";

            if (setSelectedDate.Date <= DateTime.Today) InsertionRowVisibility = "hidden";
            else InsertionRowVisibility = "visible";
        }
        public MeniulZileiViewModel(Meniu setMeniulZilei) : this(setMeniulZilei, DateTime.Today) { }
        public MeniulZileiViewModel() { }
    }
}